import { ModuleFactory } from '../factory';
import { Constructor } from '../interfaces';

/**
 * 属性注入Module
 * @param Module
 * @returns
 */
export function Injection(Module: Constructor<any>) {
    return function (target: any, propertyKey: string) {
        const module = ModuleFactory.create(Module);
        Object.defineProperty(target, propertyKey, {
            get: () => {
                return module;
            },
            enumerable: true,
            configurable: true,
        });
    };
}
